import type { Result, PageResult } from '@/types/response'
import type { RepairOrder, RepairOrderQuery, RepairOrderProgressDTO, RepairOrderAssignDTO } from '@/types/repair'
import request from '@/utils/request'

// 获取维修订单列表
export function getRepairOrderList(params: RepairOrderQuery) {
  return request.get<Result<PageResult<RepairOrder>>>('/admin/repairOrders', { params })
}

// 分配维修工
export function assignRepairUser(orderId: number, data: RepairOrderAssignDTO) {
  return request.put<Result<RepairOrder>>(`/admin/repairOrders/${orderId}/assign`, data)
}

// 更新维修进度
export function updateProgress(orderId: number, data: RepairOrderProgressDTO) {
  return request.put<Result<RepairOrder>>(`/admin/repairOrders/${orderId}/progress`, data)
}

// 获取维修工列表
export function getRepairUserList() {
  return request.get<Result<{ id: number; name: string }[]>>('/admin/users')
} 